<?php

namespace slinks\common\matcher\reflection;

use slinks\common\matcher\text\StringRegExMatcher;
use slinks\common\matcher\IMatcher;

/**
 * This matcher matches ReflectionMethod->getName() against a regular expression pattern. 
 * It the $canidate is not a string it will be cast to one. 
 * 
 * @author Navid Mitchell
 *
 */
class ReflectionMethodRegExMatcher extends StringRegExMatcher implements IMatcher {

    /**
     * Construct a new ReflectionMethodRegExMatcher with the given regular expression pattern. 
     * @param string $pattern
     */
    function __construct($pattern) {
        parent::__construct($pattern);
    }

    /**
     * Called to determine if a given canidate "Matches" the given regular expression pattern. 
     * 
     * @param ReflectionMethod $canidate
     * @return bool true if the canidate "Matches" false if not.
     */
    public function matches($canidate) {
        parent::matches($canidate->getName());
    }

}
